package com.guardchina.framework.web.converter;

import com.guardchina.framework.util.utils.DateUtil;
import org.apache.commons.lang3.StringUtils;
import org.springframework.core.convert.converter.Converter;

import java.time.LocalDate;

/**
 * 描述：时间类型转换器
 *
 * @author lwb
 * @date 2019/8/14 11:00
 */
public class LocalDateConverter implements Converter<String, LocalDate> {
    @Override
    public LocalDate convert(String source) {
        if(StringUtils.isBlank(source)){
            return null;
        }
        return DateUtil.getLocalDate(source);
    }
}
